package scrumtaculous.domain;

import java.util.ArrayList;
import java.util.List;

/** InnoDB free: 41984 kB; (`iteration_id`) REFER `scrumtaculous/iteration`(`id`) */
public class Story extends DataTransferObject
{

   // Attributes
   Integer id;
   String name;
   Integer iterationId;
   Integer ordinal;
   Integer points;
   Integer version;

   public static List<Integer> VALID_POINTS;
   static
   {
      VALID_POINTS = new ArrayList<Integer>();
      VALID_POINTS.add(0);
      VALID_POINTS.add(1);
      VALID_POINTS.add(2);
      VALID_POINTS.add(3);
      VALID_POINTS.add(5);
      VALID_POINTS.add(8);
      VALID_POINTS.add(13);
      VALID_POINTS.add(21);
      VALID_POINTS.add(34);
      VALID_POINTS.add(55);
      VALID_POINTS.add(89);
   }

   /**  */
   @Override
   public Integer getId()
   {
      return id;
   }

   /** , returns this instance so you can chain sets */
   @Override
   public void setId(Integer idIn)
   {
      id = idIn;
   }

   /**  */
   public String getName()
   {
      return name;
   }

   /** , returns this instance so you can chain sets */
   public void setName(String nameIn)
   {
      nameIn = cleanStringInput(nameIn);
      name = nameIn;
   }

   /**  */
   public Integer getIterationId()
   {
      return iterationId;
   }

   /** , returns this instance so you can chain sets */
   public void setIterationId(Integer iterationIdIn)
   {
      iterationId = iterationIdIn;
   }

   /**  */
   public Integer getOrdinal()
   {
      return ordinal;
   }

   /** , returns this instance so you can chain sets */
   public void setOrdinal(Integer ordinalIn)
   {
      ordinal = ordinalIn;
   }

   /**  */
   public Integer getPoints()
   {
      return points;
   }

   public void setPoints(Integer pointsIn)
   {
      if (pointsIn == null)
      {
         return;
      }

      if (VALID_POINTS.contains(pointsIn))
      {
         points = pointsIn;
      }
      else
      {
         throw new IllegalArgumentException("point must be a fibonacci number from 0 to 89 or null but was " + pointsIn);
      }
   }

   /**  */
   @Override
   public Integer getVersion()
   {
      return version;
   }

   /** , returns this instance so you can chain sets */
   @Override
   public void setVersion(Integer versionIn)
   {
      version = versionIn;
   }
}
